//package nbcp
//
//import com.fasterxml.jackson.core.JsonGenerator
//import com.fasterxml.jackson.core.JsonParser
//import com.fasterxml.jackson.databind.DeserializationContext
//import com.fasterxml.jackson.databind.JsonDeserializer
//import com.fasterxml.jackson.databind.JsonSerializer
//import com.fasterxml.jackson.databind.SerializerProvider
//import org.bson.types.ObjectId
//import org.springframework.stereotype.Component
//
///**
// * Created by yuxh on 2018/9/18
// */
//
//
//// 先定义一个json生成器
//@Component
//class ObjectIdJsonSerializer : JsonSerializer<ObjectId>() {
//    override fun serialize(o: ObjectId?, j: JsonGenerator, s: SerializerProvider) {
//        if (o == null) {
//            j.writeNull()
//        } else {
//            j.writeString(o.toString())
//        }
//    }
//
//    override fun handledType(): Class<ObjectId> {
//        return ObjectId::class.java
//    }
//}
//
//
////@Component
////class ObjectIdJsonDeserializer:JsonDeserializer<ObjectId>(){
////    override fun deserialize(o: JsonParser?, con: DeserializationContext?): ObjectId {
////            throw Exception("OIIODF")
////    }
////
////    override fun handledType(): Class<*> {
////        return super.handledType()
////    }
////}